import axios from 'axios'
import Vue from 'vue'


axios.defaults.baseURL = process.env.VUE_APP_BASEURL;
var AUTH_TOKEN = localStorage.getItem("token")
axios.defaults.headers.common['Authorization'] = "Bearer " + AUTH_TOKEN;
axios.defaults.headers.post['Content-Type'] = 'multipart/form-data';
axios.interceptors.request.use(function(config) {
	// 在发送请求之前做些什么，例如加入token
	return config
}, function(error) {
	// 对请求错误做些什么
	return Promise.reject(error);
});

var mtAxios = {
	get: function(url, pramas) {
		return axios.get(url, {
			pramas: pramas
		});
	},
	post: function(url, pramas) {
		return axios.post(url, pramas)
	}
}
Vue.prototype.$http = mtAxios;
export default mtAxios;
